package com.smh.a04LambdaDemo4;

public class LambdaDemo2 {
    public static void main(String[] args) {


        method(new Swim() {
            @Override
            public void swimming() {
                System.out.println("a");
            }
        });

        //只能接口能用lambda方法
        method(() -> {
            System.out.println("ads");
        });

        method(()-> System.out.println("zxczc"));


    }

    public static void method(Swim swim) {
        swim.swimming();
    }
}

//只有一个方法的接口,叫做函数式接口
@FunctionalInterface
interface Swim {
    public abstract void swimming();
}
